import request from '@/utils/request'

/**
 * 获取验证码
 * @param {Number} phone 手机号
 * @returns
 */
export const reqGetCode = (phone) => {
	return request({
		method: 'GET',
		url: `/user/passport/sendCode/${phone}`,
	})
}

/**
 * 注册接口
 * @param {Object} data 手机号 密码 验证码
 * @returns
 */
export const reqGetRegister = (data) => {
	return request({
		method: 'POST',
		url: '/user/passport/register',
		data,
	})
}

/**
 *
 * @param {string} phone  手机号
 * @param {string} password  密码
 * @returns
 */
export const reqPassport = (phone, password) => {
	return request({
		method: 'POST',
		url: '/user/passport/login',
		data: {
			phone,
			password,
		},
	})
}

/**
 * 退出登录
 * @returns  请求拦截 有token 默认发送token
 */
export const reqLogout = () => {
	return request({
		method: 'GET',
		url: '/user/passport/logout',
	})
}
